﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using AtlantisRevenge.GamePlay;

namespace AtlantisRevenge.GamePlay.Estados
{
    /// <summary>
    /// A tela de introdução que é exibida assim que o jogo é carregado
    /// </summary>
    public class Creditos : EstadoBase
    {
        Vector2 centralizarLogo;
        float centroX;
        float y;
        Botao irparamenu;
        SpriteFont arial;
        SpriteFont arial_large;

        #region texto
        String linha1 = "Game Design:";
        String linha2 = "Daniel Barreiros";
        String linha3 = "Rodrigo Armada Señorans";

        String linha4 = "Game Developers:";
        String linha5 = "Cleber Tavares Jr";
        String linha6 = "Eduardo Canongia";
        String linha7 = "Lucas Lima";
        String linha8 = "Pedro Santos";
        String linha9 = "Rafael Alves";

        String linha10 = "Game Art:";
        #endregion

        public Creditos(ContentManager Content, GameWindow Window)
            : base(Content, Window)
        {
            arial = Content.Load<SpriteFont>("Fonts/arial");
            arial_large = Content.Load<SpriteFont>("Fonts/arial_large");

            // Determinar o tamanho do texto

            centroX = Window.ClientBounds.Width / 2;
            y = Window.ClientBounds.Height;

            fundo = Content.Load<Texture2D>("Backgrounds/seven");
            centralizarLogo.X = centroX - fundo.Width / 2;
            centralizarLogo.Y = y * 0.1f - fundo.Height / 2;

            irparamenu = new Botao(Content, Window, "Botoes/irparamenu");
            irparamenu.posicao.X = centroX - irparamenu.textura.Width / 2;
            irparamenu.posicao.Y = y * 0.9f;
        }

        public void Update(GameTime gameTime)
        {
            irparamenu.Update(gameTime);
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(fundo, centralizarLogo, cor);
            
            spriteBatch.DrawString(arial_large,linha1,new Vector2 (centroX - (arial_large.MeasureString(linha1).X / 2),y * 0.2f),Color.White);
            spriteBatch.DrawString(arial, linha2, new Vector2(centroX - (arial.MeasureString(linha2).X / 2), y * 0.2f + arial_large.MeasureString(linha1).Y ), Color.White);
            spriteBatch.DrawString(arial, linha3, new Vector2(centroX - (arial.MeasureString(linha3).X / 2), y * 0.2f + arial_large.MeasureString(linha1).Y + arial.MeasureString(linha2).Y), Color.White);
            
            spriteBatch.DrawString(arial_large, linha4, new Vector2(centroX - (arial_large.MeasureString(linha4).X/2), y * 0.35f), Color.White);
            spriteBatch.DrawString(arial, linha5, new Vector2(centroX - (arial.MeasureString(linha5).X / 2), y * 0.35f + arial_large.MeasureString(linha1).Y), Color.White);
            spriteBatch.DrawString(arial, linha6, new Vector2(centroX - (arial.MeasureString(linha6).X / 2), y * 0.35f + arial_large.MeasureString(linha1).Y + arial.MeasureString(linha5).Y), Color.White);
            spriteBatch.DrawString(arial, linha7, new Vector2(centroX - (arial.MeasureString(linha7).X / 2), y * 0.35f + arial_large.MeasureString(linha1).Y + arial.MeasureString(linha5).Y * 2), Color.White);
            spriteBatch.DrawString(arial, linha8, new Vector2(centroX - (arial.MeasureString(linha8).X / 2), y * 0.35f + arial_large.MeasureString(linha1).Y + arial.MeasureString(linha5).Y * 3), Color.White);
            spriteBatch.DrawString(arial, linha9, new Vector2(centroX - (arial.MeasureString(linha9).X / 2), y * 0.35f + arial_large.MeasureString(linha1).Y + arial.MeasureString(linha5).Y * 4), Color.White);
            
            spriteBatch.DrawString(arial_large, linha10, new Vector2(centroX - (arial_large.MeasureString(linha10).X/2), y * 0.6f), Color.White);
            
            irparamenu.Draw(gameTime, spriteBatch);
        }

    }
}
